import 'package:app_test/pub_page.dart';
import 'package:flutter/material.dart';

import 'const.dart';

class NewsListPage extends StatefulWidget {
  const NewsListPage({super.key});

  @override
  State<NewsListPage> createState() => _NewsListPageState();
}

class _NewsListPageState extends State<NewsListPage> {
  static GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();

  bool isE = false;
  bool isE1 = false;
  @override
  Widget build(BuildContext context) {
    mScreenHeight = MediaQuery.of(context).size.width;
    mScreenWidth = MediaQuery.of(context).size.height;
    return Scaffold(
      body: ListView.builder(
        key: ValueKey('LisyView'),
        itemBuilder: (BuildContext context, int index) {
          if (index == 0) {
            return Container(
              margin: EdgeInsets.only(bottom: 20),
              height: 100,
              color: Colors.pink[100],
            );
          }
          return GestureDetector(
            onTap: () {
              showDialog(
                  context: context,
                  builder: (BuildContext context) {
                    return const PubPage();
                  });
            },
            child: Container(
              key: ValueKey('new$index'),
              margin: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
              width: 200,
              height: 160,
              color: Colors.blue,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Padding(
                    padding: const EdgeInsets.symmetric(
                        horizontal: 20, vertical: 10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          index != 10 ? '[News Title]' : 'Lundon',
                          style: TextStyle(fontSize: 26, color: Colors.white),
                        ),
                        Text('$index',
                            style: const TextStyle(
                                fontSize: 26,
                                color: Colors.white,
                                fontWeight: FontWeight.w800))
                      ],
                    ),
                  ),
                  const Padding(
                    padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text(
                          'Skill Name',
                          style: TextStyle(fontSize: 18, color: Colors.white),
                        ),
                        Text('News Datetime',
                            style: TextStyle(
                              fontSize: 18,
                              color: Colors.white,
                            ))
                      ],
                    ),
                  ),
                ],
              ),
            ),
          );
        },
        itemCount: 120,
      ),
    );
  }
}
